package com.wdb.doctor;

import com.wdb.common.configurer.authority.AuthorityResponse;
import com.wdb.common.configurer.subject.SubjectTarget;
import com.wdb.common.configurer.subject.Subjected;
import com.wdb.doctor.fallback.DoctorInfoFallback;
import com.wdb.domain.doctor.request.DoctorPinLoginRequest;
import com.wdb.domain.doctor.response.DoctorInfoResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.Map;


@FeignClient(name = "com-wdb-doctor",fallback = DoctorInfoFallback.class)
public interface DoctorInfoService {

    @GetMapping("/doctor")
    @Subjected(target = SubjectTarget.DOCTOR)
    @ResponseStatus(HttpStatus.OK)
    Map<String,Object> findDoctorInfo(@RequestParam("id")Long id);

    @GetMapping("/doctor/info")
    @Subjected(target = SubjectTarget.DOCTOR)
    @ResponseStatus(HttpStatus.OK)
    DoctorInfoResponse findDoctorInfos();

    @GetMapping("/doctor/user")
    @Subjected(target = SubjectTarget.DOCTOR)
    @ResponseStatus(HttpStatus.OK)
    Map<String,Object> findUserInfo(@RequestParam("id")Long id);

    @PostMapping("/auth/login")
    @Subjected(target = SubjectTarget.INVOKE)
    @ResponseStatus(HttpStatus.CREATED)
    AuthorityResponse login(@RequestBody DoctorPinLoginRequest request);

}
